package com.changyinBus.web.controller.system;

import com.alibaba.fastjson2.JSONObject;
import com.changyinBus.common.core.controller.BaseController;
import com.changyinBus.common.core.domain.AjaxResult;
import com.changyinBus.common.core.domain.entity.SysLotteryRecords;
import com.changyinBus.system.service.ISysLotteryRecordsService;
import com.changyinBus.system.service.ISysTransferService;
import com.changyinBus.system.service.ISysWxInfoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/system/statistics")
public class SysStatisticsController extends BaseController {

    @Resource
    private ISysWxInfoService infoService;
    @Resource
    private ISysLotteryRecordsService sysLotteryRecordsService;
    @Resource
    private ISysTransferService sysTransferService;


    @GetMapping(value = { "/count" })
    public AjaxResult getInfo() {
        JSONObject result = new JSONObject();
        result.put("userCount",infoService.getCount());
        SysLotteryRecords param = new SysLotteryRecords();
        result.put("lotteryCount",sysLotteryRecordsService.getCount(param));
        param.setStatus("Y");
        result.put("winPrizeCount",sysLotteryRecordsService.getCount(param));
        result.put("transferCount",sysTransferService.getCount());
        result.put("transferCumulative",sysTransferService.getAmount());
        return success(result);
    }
}
